package singleton.demo05;

/**
 * 懒汉式(同步代码块) 线程安全, 效率仍然低下,双重检查的雏形
 */
public class Singleton05 {

    private static Singleton05 instance;

    private Singleton05 () {};

    public static Singleton05 getInstance(){
        synchronized (Singleton05.class){
            if (instance == null){
                instance = new Singleton05();
            }
            return instance;
        }

    }
}
